const { app, BrowserWindow, Menu } = require('electron');
const { join } = require('path');
function createWindow() {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 1600,
    height: 900,
    webPreferences: {
      preload: join(__dirname, 'preload.js')
    },
    icon: join(__dirname, 'favicon.ico'), // icon
  })
  // and load the index.html of the app.
  mainWindow.loadFile('dist/index.html');
  // mainWindow.loadURL('http://127.0.0.1:8080/draw/');
}
app.whenReady().then(() => {
  Menu.setApplicationMenu(null)
  createWindow();
  app.on('activate', function () {
    // On macOS it's common to re-create a window in the app when the
    // dock icon is clicked and there are no other windows open.
    if (BrowserWindow.getAllWindows().length === 0) createWindow()
  })
})
app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') app.quit()
})